import { defineStore } from 'pinia'

export const useWarehouseStore = defineStore('warehouse', () => {

  function setWarehouse(_warehouse) {
    localStorage.setItem('x-dataview-warehouse', _warehouse)
  }

  function getWarehouse() {
    let _warehouse = localStorage.getItem('x-dataview-warehouse')
    if (_warehouse) {
      return _warehouse;
    } else {
      return '';
    }
  }

  function clearWarehouse() {
    localStorage.removeItem('x-dataview-warehouse')
  }

  return { setWarehouse, getWarehouse, clearWarehouse }
})

export default useWarehouseStore
